#include "robolite.h"

//RoboLite assist function implementation file

#if USE_ASSIST||FULL_CODE

void rl_waitSound(uchar t)
{
    #warning "rl_wait_sound compiled."
    uint time;
    time=t*10000;
    
    rl_delay_ms(300);

    rl_clearBit(PORTC,PC5); //clear port

    while(rl_getBit(PINC,PC5)!=0&&(time--))
    {
        //noop
        rl_delay_us(50);
    }

}

void rl_detectSensors(void)
{
    #warning "rl_detectSensors compiled."
    if(impact(RL_SENSOR_FORE))
    {
        rl_light_on(RL_LED_FORE);
    }
    else
    {
        rl_light_off(RL_LED_FORE);
    }

    if(impact(RL_SENSOR_LEFT))
    {
        rl_light_on(RL_LED_LEFT);
    }
    else
    {
        rl_light_off(RL_LED_LEFT);
    }

    
}

#endif
